<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id='app'>
        <div>姓：<input type="text" v-model="firstName"></div>
        <div>名：<input type="text" v-model="lastName"></div>
        <div>姓名: {{getFullName()}}</div>
    </div>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                firstName: '',
                lastName: '',
                fullName: ''
            },
            methods: {
                getFullName(){
                    return this.firstName + this.lastName 
                }
            },
            // beforeUpdate() {
                // this.fullName = this.firstName + this.lastName
            // },
        })
    </script>
</body>

</html>